|
|
|
| |
|
|
|
|
If your graph does not show the legends on the right, you may need to enlarge your graph display image. The graph control determines the exact placement and sizing of all titles, legends, and labels. |
|
|
|
|
|
|
|
|
|
|
You can also send the completed graph to a file, to the Windows Clipboard, or to your printer. All those options are covered in the next section. For now, you add a button that writes the completed graph to a disk file as a bitmap image. |
|
|
|
|
|
|
|
|
Add one more command button to the form. Set its Name property to cmdWrite and its Caption property to &Write. Add Listing 11.6 to the cmdWrite_Click event window. |
|
|
|
|
|
|
|
|
Listing 11.6. Adding code to the cmdWrite_Click event. |
|
|
|
|
|
|
|
|
Private Sub cmdWrite_Click()
'
Graph1.ImageFile = App.Path + "\GraphDesign.BMP" ' set file name
Graph1.DrawMode = gphBlit ' set for bitmap mode
Graph1.DrawMode = gphWrite ' force to file
Graph1.DrawMode = gphDraw ' redraw control
'
End Sub |
|
|
|
|
|
|
|
|
In Listing 11.6, you first set the name of the file to be created. Then you set the drawing mode to bitmap. You then force the creation of the graph file, and, finally, redraw the graph on-screen. |
|
|
|
|
|
|
|
|
Save and run the project. You see the screen flicker during the redrawing. If you check your disk drive, you find the data file you created. You can load this file using Microsoft Paint or any other program that can read bitmap images. Figure 11.9 shows both the Visual Basic 5 form and Microsoft Paint running at the same time. |
|
|
|
|
|